﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Configuration;
using System.DirectoryServices.AccountManagement;

using LeMigue.Framework.Utils;

using LeMigue.Scrum.Iterface.Model;

using LeMigue.TeamPortal.Base.Mvc;
using LeMigue.TeamPortal.Base.View;
using LeMigue.TeamPortal.Base.Biz.Interface;
using LeMigue.TeamPortal.Base.Biz.Implement;
using LeMigue.TeamPortal.Base.Biz;


namespace LeMigue.TeamPortal.Controllers
{
    [Authorize]
    public class HomeController : TeamPortalController
    {
        private ITeamBiz TeamBiz = FactoryBiz.TeamBiz;

        #region navegação principal

        [MainMenu("MainMenuHome", 0)]
        public ActionResult Index(int? id)
        {

            if(Team == null && !id.HasValue)
                return SelectTeam();

            TeamBiz.Load(id);

            return View();
        }

        public ActionResult SelectTeam()
        {
            return View("SelectTeam");
        }
        #endregion
        

        [ChildActionOnly]
        public PartialViewResult MainMenu()
        {
            if (Team == null)
                return PartialView("Empty");

            return PartialView();
        }

        [ChildActionOnly]
        public PartialViewResult TeamName()
        {
            if (Team == null)
                return PartialView("NoTeamName");

            return PartialView(TeamBiz.TeamView(Team,true));
        }

        [ChildActionOnly]
        public PartialViewResult TeamList()
        {

            IList<TeamView> projetos = TeamBiz.List(Team);

            return PartialView(projetos);
        }


    }
}
